package com.itqf.mybatis;

import com.itqf.mapper.DtsAdminMapper;
import com.itqf.pojo.DtsAdmin;
import com.itqf.utils.SqlSessionUtils;
import org.apache.ibatis.session.SqlSession;

/**
 * projectName: mybatisgp8
 *
 * @author: 赵伟风
 * time: 2021/7/30 10:35
 * description:插入和修改
 */
public class UseTypeHandlerDML {


    public static void main(String[] args) {

        SqlSession sqlSession = SqlSessionUtils.openSession();

        DtsAdminMapper mapper = sqlSession.getMapper(DtsAdminMapper.class);

        DtsAdmin dtsAdmin = new DtsAdmin();
        dtsAdmin.setPassword("root");
        dtsAdmin.setUsername("root");

        Integer [] roleIds = new Integer[]{10,11};
        dtsAdmin.setRoleIds(roleIds);


        int insert = mapper.insert(dtsAdmin);

        System.out.println("insert = " + insert);
        System.out.println(dtsAdmin);

        sqlSession.commit();
        sqlSession.close();


    }
}
